
package com.utils.web.jdbc;
 
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.Properties;
import java.util.Scanner;

  
public class TestMdb {  
    /** 
     * TODO : 读取文件access 
     *  
     * @param filePath 
     * @return 
     * @throws ClassNotFoundException 
     */  
    public static void readFileACCESS(File mdbFile) {  
        Properties prop = new Properties();  
        prop.put("charSet", "gb2312"); // 这里是解决中文乱码  
        prop.put("password", "bzhh89042");  
        String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="  
                + mdbFile.getAbsolutePath();  
        Statement stmt = null;  
        ResultSet rs = null;  
        String tableName = null;  
        try {  
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  
            // 连接到mdb文件  
            Connection conn = DriverManager.getConnection(url, prop);  
            ResultSet tables = conn.getMetaData().getTables(  
                    mdbFile.getAbsolutePath(), null, null,  
                    new String[] { "TABLE" });  
            // 获取第一个表名  
            if (tables.next()) {  
                tableName = tables.getString(3);// getXXX can only be used once  
            } else {  
                return;  
            }  
            stmt = (Statement) conn.createStatement();  
            // 读取第一个表的内容  
            rs = stmt.executeQuery("select * from " + tableName);  
            ResultSetMetaData data = rs.getMetaData();  
            while (rs.next()) {  
                for (int i = 1; i <= data.getColumnCount(); i++) {  
                    System.out.print(rs.getString(i) + "    ");  
                }  
                System.out.println();  
            }  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
    }  
  
    @SuppressWarnings("resource")
	public static void main(String[] args) {  
//        readFileACCESS(new File("C:\\Users\\XR-8\\Desktop\\BzHunpei.mdb")); 
        Scanner reader = new Scanner(System.in);
        String x = reader.next();
        switch(x.toCharArray()[0]) {
        case 'A':
        	System.out.println("90-100");
        	break;
        }
    }  
} 
